use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};

pub fn generate_post_id() -> String {
    thread_rng()
        .sample_iter(&Alphanumeric)
        .take(11)
        .map(char::from)
        .collect()
}

#[cfg(test)]
mod tests {
    use super::generate_post_id;

    #[test]
    fn test_generate_post_id() {
        let pid = generate_post_id();
        println!("{}", pid)
    }
}
